namespace study6_03 {

    // Record 记录

    // 源码
    // type Record<K extends keyof any, T> = {
    //     [p in K]: T
    // }

    type key = string | number | symbol

    // 定义传入的值
    type Persona = {
        name: string,
        age: number,
        text: string
    }

    //定义可传入的健
    type K = "a" | "b" | "c"


    type newRecord = Record<K, Persona>

    let obj: newRecord = {
        'a': { name: 'xiaonan', age: 23, text: 'xxxx' },
        'b': { name: 'xiaonan', age: 23, text: 'xxxx' },
        'c': { name: 'xiaonan', age: 23, text: 'xxxx' },
    }
    console.log(obj);





    class Student {
        constructor(
            public str: string,
            public num: number
        ) { }
    }

    type studentInfo = Record<keyof Persona, Student> // 实现下面的代码
    // type studentInfo = {
    //     text: Student;
    //     age: Student;
    //     name: Student;
    // }
    let stuData: studentInfo = {
        age: new Student('ads', 124),
        name: new Student('ads', 124),
        text: new Student('ads', 124),

    }
    console.log(stuData);

}